<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" base="text/html; charset=UTF-8">

    <title>管理后台登录</title>
    <link href="${staticPath}/base/css/style_login.css?v=${staticVersion}" rel="stylesheet" type="text/css"/>
    <script src="${staticPath}/base/js/jquery-1.8.3.min.js"></script>
</head>
<<input type="hidden" id="domain" value="${basePath}">
<body class="login" mycollectionplug="bind">
<div class="login_m">
    <div class="login_logo"><img src="${staticPath}/base/images/logo.png" width="196" height="46"></div>
    <div class="login_boder">

        <div class="login_padding" id="login_model">
            <h2>USERNAME</h2>
            <label>
                <input type="text" id="username" class="txt_input txt_input2"
                       onfocus="if (value ==&#39;Your name&#39;){value =&#39;&#39;}"
                       onblur="if (value ==&#39;&#39;){value=&#39;Your name&#39;}" value="Your name">
            </label>
            <h2>PASSWORD</h2>
            <label>
                <input type="password" name="textfield2" id="userpwd" class="txt_input"
                       onfocus="if (value ==&#39;******&#39;){value =&#39;&#39;}"
                       onblur="if (value ==&#39;&#39;){value=&#39;******&#39;}" value="******">
            </label>

            <div class="rem_sub">
                <div class="rem_sub_l">
                    <input type="checkbox" name="checkboxr" id="save_me">
                    <label for="checkboxr">Remember me</label>
                </div>
                <label>
                    <input type="submit" class="sub_button" name="button" id="button" onclick="login()" value="SIGN-IN"
                           style="opacity: 0.7;">
                </label>
            </div>
        </div>

    </div>
</div>
<br> <br>
<script type="text/javascript">
    function login() {
        var uname = $("#username").val();
        var upwd = $("#userpwd").val();
        if (uname == "" || uname.length <= 4) {
            alert("请输入正确的用户名称");
            return;
        }
        if (upwd == "" || upwd.length <= 4) {
            alert("请输入正确的密码");
            return;
        }
        var domain = $("#domain").val();
        $.post("${staticPath}/ajax/manage/login", {login_name: uname, password: upwd}, function (d) {
            if (d.code == 1) {
                window.location = "${staticPath}/main/index";
            }
            else {
                alert("账号或密码错误");
            }
        });
    }
    $(document).keyup(function (event) {
        if (event.keyCode == 13) {
            login();
        }
    });
</script>
</body>
</html>